package pers.vic.practice.module.statistics.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 描述:charJs  bar model
 * @author Vic.xu
 * @date 2022-04-21 11:37
 */
public class CharBarModel {


    private List<String> labels;

    private Map<String, List<Object>> datasets;

    public CharBarModel(){
        labels = new ArrayList<>();
        datasets = new HashMap<>();
    }

    public List<String> getLabels() {
        return labels;
    }

    public CharBarModel addLabels(String label){
        labels.add(label);
        return this;
    }
    public CharBarModel addDatasets(String subLabel, Object data){
        List<Object> datas = datasets.get(subLabel);
        if (datas == null) {
            datas = new ArrayList<>();
            datasets.put(subLabel, datas);
        }
        datas.add(data);
        return this;
    }


    public void setLabels(List<String> labels) {
        this.labels = labels;
    }

    public Map<String, List<Object>> getDatasets() {
        return datasets;
    }

    public void setDatasets(Map<String, List<Object>> datasets) {
        this.datasets = datasets;
    }
}
